<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=1611821581" type="text/javascript" charset="utf-8"></script>
<div id="bg"></div>
<div id="login_formbox" >
	<h2><span onclick="openLoginBg(0);openLoginSelect(0);"><img src="http://www.weilaiwd.com/r/cms/wd_user/images/user_close.png" /></span></h2> 
    <form name="form" id="form" method="post" >
    <ul>   
       <h3>欢迎登录未来财经</h3>
       <li><input autocomplete="off" class="user_name" id="username" name="username" type="text" value="用户名/邮箱/手机号" onFocus="if(value==defaultValue){value='';this.style.color='#333'}" onBlur="if(!value){value=defaultValue;this.style.color='#999'}" style="color:#999;"></li>
       <li><input autocomplete="off" class="user_pwd" id="password" name="password" type="password" value="请输入密码" onFocus="if(value==defaultValue){value='';this.style.color='#333'}" onBlur="if(!value){value=defaultValue;this.style.color='#999'}"  style="color:#999;"></li>
       <li class="user_word"><div id="rem" style="width: 100px;height:25px;float:left"><input name="checkid" id="rememberMe" type="checkbox" value=""> 记住账号</div><div id="error" style="color:red;width:100px;height:25px;float:left"></div><div id="forget" style="width:100px;height:25px;float:left"><a style="margin-left:30px;width:80px;height:25px;" href="http://www.weilaiwd.com/forget/forget_password.jspx" target="_blank">忘记密码？</a></div>
		</li>
       <li><input class="btn" name="login" style="cursor:pointer" type="button" value="登 录" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn_out'"></li>
       <li class="user_word1">还没有账号，<a href="http://www.weilaiwd.com/register.jspx" target="_blank" >快速注册</a></li>
       <li class="user_xian"><img src="http://www.weilaiwd.com/r/cms/wd_user/images/user_xian14.gif" width="297" height="2"></li>
       <li><h4>第三方账号登录</h4></li>
       <li>
      			<a id="wb_connect_btn" class="login_btn1" href="javascript:void(0);" style="cursor: pointer;"></a>
						</li>  	
       <li>
       <a class="login_btn2" onclick="qqdenglu();" href="javascript:;"></a>
		</li>
    </ul>
	</form>
		
</div>

<script type="text/javascript">
$(function(){
	var lc = location+'';
	if (lc.indexOf('182.92.239.238')>0){
	     lc = lc.replace("182.92.239.238:8080","www.weilaiwd.com");
	     }
	 if(lc.indexOf('123.56.130.38')>0 ){
	 	lc = lc.replace("123.56.130.38:8080","www.weilaiwd.com");
	 	}
	 	
	 	 $("#wb_connect_btn").click(function(){
		 WB2.login(function(){
				location="http://www.weilaiwd.com/public_auth.jspx?fromto="+lc;
		})
		})
	});
	function qqdenglu(){
		var lc = location+'';
		if (lc.indexOf('182.92.239.238')>0){
		     lc = lc.replace("182.92.239.238:8080","shuju.weilaiwd.com");
		     }
		 if(lc.indexOf('123.56.130.38')>0 ){
		 	lc = lc.replace("123.56.130.38:8080","shuju.weilaiwd.com");
		 	}
		window.open("http://openapi.qzone.qq.com/oauth/show?which=ConfirmPage&display=pc&client_id=101195964&response_type=token&scope=all&redirect_uri=http://www.weilaiwd.com/public_auth.jspx?fromto="+lc);
	}
$(".btn").click(function(){
	/* $.ajax({
			url: "${basePath}/www/login?type=1",//http://www.weilaiwd.com/login.jspx?type=1
			 data: $("#form").serialize(),
			 type:'post',
			 contentType: "application/x-www-form-urlencoded; charset=utf-8", 
			 dataType:"html", 
			 crossDomain: true,  
			 success: function(data){
			 if(data.indexOf("html") < 0){
			 	data = eval("("+data+")");
				  if(data.msg=="org.apache.shiro.authc.IncorrectCredentialsException"){
				 $("#error").html('密码错误');
				 }else if(data.msg=="org.apache.shiro.authc.UnknownAccountException"){
				 //$("#error").html('[@s.m "error.usernameNotExist"/]');
				 $("#error").html('用户不存在');
				 }else if(data.msg=="com.jeecms.common.security.CaptchaErrorException"){
				 $("#error").html('验证码不正确');
				 }else if(data.msg=="com.jeecms.common.security.DisabledException"){
				 // $("#error").html('[@s.m "error.userDisabled"/]');
				 $("#error").html('用户不存在');
				 }
			 }else{
				 openLoginSelect(-1);
				 openLoginBg(-1);
				 $(".regdenglu").hide();
				 $("#t_comment").show();
					 $("#eval").show();
				//window.location.reload(); 
				$("#page-top").load("${basePath}/top");
			 }
				 
			 }
	}); */
	
	$.ajax({
		   async:false,
		   url: "http://www.weilaiwd.com/userOtherInfo.jspx?isPopLogin=200",
		   type: "GET",
		   dataType: 'jsonp',
		   jsonp: 'callback',
		   data: $("#form").serialize(),
		   timeout: 5000,
		   success: function (json) {//客户端jquery预先定义好的callback函数,成功获取跨域服务器上的json数据后,会动态执行这个callback函数
			  if(!json.success){
				  $("#error").html(json.msg);
			  }else{
				  var url =""; 
				  url+=window.location;
				  if(url.indexOf("#")>0){
				 	 window.location = url.substr(0,url.indexOf("#"));
				  }else{
					  window.location = url;
				  }
			  }
		   }
		});
});
function popLogin(url){
	var flag = '${sessionScope.login_user_id eq null }';
	var result = false;
	if(flag=='true'){
		openLoginBg(1);
		openLoginSelect(1);
	}else{
		/* if(url){
		 	window.location.href=url; 
		} */
		result = true;
	}
	return result;
}

</script>
